package com.netcracker.training.automonic.dao.factories;

import com.netcracker.training.automonic.dao.factories.oracle.OracleDAOFactory;
import com.netcracker.training.automonic.dao.roles.ReadWriteDAO;
import com.netcracker.training.automonic.dao.roles.ReadDAO;
import com.netcracker.training.automonic.dao.roles.WriteDAO;

/**
 * Abstract DAO factory. All concrete DAO factories must extends this class.
 * 
 * @author Vadim Gidulyan
 */

public abstract class DAOFactory
{

	// List of DAO types supported by the factory
	/**
	 * Oracle Database Express Edition 11g Release 2
	 */
	public static final int ORACLE = 1;
	
	/**
	 * Returns DAO role with full rights.
	 * 
	 * @return DAO role
	 */
	public abstract ReadWriteDAO getReadWriteDAO();
	
	/**
	 * Returns DAO role with rights READ ONLY.
	 * 	
	 * @return DAO role
	 */
	public abstract ReadDAO getReadDAO();
	
	/**
	 * Returns DAO role with rights WRITE ONLY.
	 * 
	 * @return DAO role
	 */
	public abstract WriteDAO getWriteDAO();
	
	/**
	 * Get concrete DAO factory.
	 * 
	 * @param factory concrete factory
	 * 
	 * @return concrete DAO factory otherwise null
	 */
	public static DAOFactory getDAOFactory(int factory)
	{
		switch (factory)
		{
			case ORACLE:
				return new OracleDAOFactory();
			default:
				return null;
		}
	}

}
